package com.jingtai.shop.common.template;

import com.jingtai.core.template.BaseController;
import com.jingtai.shop.common.utils.JwtTokenUtils;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

public class ShopBaseController extends BaseController {

    @Resource
    private JwtTokenUtils jwtTokenUtils;

    /**
     * 获取用户ID
     *
     * @return 用户ID
     */
    public Long getUserId() {
        HttpServletRequest request = getRequest();
        return jwtTokenUtils.getUserIdFromToken(request);
    }
}
